function isEmpty(str) {
    return (!str || 0 === str.length);
}

function isFloat(n) {
    return n === +n && n !== (n | 0);
}

function isNumber(n) {
    return !isNaN(parseFloat(n)) && isFinite(n);
}

function isInteger(n) {
    var y = parseInt(n, 10);
    return !isNaN(y) && n == y && n.toString() == n.toString();
}

function isEmail(email) {
    var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
    return re.test(email);
}

function setError(id, message) {
    $("#" + id + "-message").html("<span class='label label-danger'>" + message + "</span><br/>");
}

function clearError(id) {
    $("#" + id + "-message").empty();
}

function getAge(birthday) {
    birthday = new Date(birthday);
    return new Number((new Date().getTime() - birthday.getTime()) / 31536000000).toFixed(0);
}